package com.stox.client.ui.javafx.workbench.lifecycle;

import com.stox.services.charting.repository.ChartGroupFileRepository;
import com.stox.services.charting.repository.SavedChartFileRepository;
import com.stox.services.data.downloader.manager.DownloadManager;
import com.stox.services.data.provider.repository.file.BarFileRepository;
import com.stox.services.data.provider.repository.file.ExchangeFileRepository;
import com.stox.services.data.provider.repository.file.ScripFileRepository;
import com.stox.services.watchlist.repository.impl.WatchlistEntiryFileRepository;
import com.stox.services.watchlist.repository.impl.WatchlistFileRepository;


public class ShutdownHookRegistry extends Thread{
	
	private static final Runnable[] hooks = {
		DownloadManager.INSTANCE,
		BarFileRepository.INSTANCE,
		ScripFileRepository.INSTANCE,
		ExchangeFileRepository.INSTANCE,
		WatchlistFileRepository.INSTANCE,
		WatchlistEntiryFileRepository.INSTANCE,
		ChartGroupFileRepository.INSTANCE,
		SavedChartFileRepository.INSTANCE
	};
	public static final ShutdownHookRegistry INSTANCE = new ShutdownHookRegistry();
	
	private ShutdownHookRegistry() {
		
	}
	
	@Override
	public void run() {
		super.run();
		for(Runnable runnable : hooks){
			runnable.run();
		}
	}

}
